package com.hermeneute.fsa;

import java.util.Comparator;

class FSTTransition
{
   FSTEvent event;
   int state;

    FSTTransition() {
	state = 0;
    };
    
    FSTTransition(FSTEvent evt, int st)
    {event = evt;state = st;}
    
    boolean isNull()
    { return state == 0 && event.isNull(); }
    FSTEvent getEvent()
    { return event; }
    int getState() 
    { return state; }
    void setEvent(FSTEvent ev)
    { event = ev; }
    void setState(int ev)
    { state = ev; }

    public boolean equals (FSTTransition si)
    {
	return getEvent().equals(si.getEvent ());
    }
    public boolean lt (FSTTransition si)
    {
	return getEvent().lt(si.getEvent ());
    }
    public boolean eq (FSTTransition si)
    {
	return (getEvent().equals(si.getEvent ())&&(getState() == si.getState ()));
    }
    boolean ne (FSTTransition si)
      {
	  return (getEvent().ne(si.getEvent ())||(getState() != si.getState ()));
      }
    int compareTo (FSTTransition si)
    {
	if (event.equals(si.getEvent())){
	    return 0;
	}else if (event.lt(si.getEvent())){
	    return -1;
	}else
	    return 1;
    }
}

class FSTTransitionComparator implements Comparator {
    public int compare(Object o1, Object o2) {
	return ((FSTTransition)o1).compareTo((FSTTransition)o2);
    }
}
